<template>
	<view>
		<view class="topBar f-c-c f30">
			<view class="arrowLeft" @click="$back(1)">
				<u-icon size="40" name="arrow-left"></u-icon>
			</view>
			<view class="fw">{{topBarTitle}}</view>
		</view>

		<view class="content">
			<view class="content-item">
				<view v-for="(item,index) in list" class="item f-c-b f30"
					@click="$to(`../index_commodityclassification-detail-detail/index_commodityclassification-detail-detail?title=${item.name}&parentId=${item.id}&type=1`)">
					<view class="item-left">
						<view class="">{{item.name}}</view>
						<image src="../../static/index-cate/icon_y.png" mode="widthFix"></image>
					</view>
					<view class="item-right">
						<image :src="$u.baseUrl+item.cimg" mode="widthFix"></image>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				topBarTitle: '',
				list: []
			}
		},
		methods: {
			async TowClassify(id){
				const {data,success,msg}=await this.$u.api.TowClassify({parentId:id})
				if(!success){
					this.$u.toast(msg)
					return
				}
				this.list=data
			}
		},
		onLoad(e) {
			console.log(e);
			this.topBarTitle = e.title
			this.TowClassify(e.parentId)
		}
	}
</script>

<style scoped lang="scss">
	.topBar {
		height: 80rpx;
	}

	.arrowLeft {
		position: absolute;
		left: 20rpx;
	}

	.content {
		height: 100vh;
		background-color: #F6F6F6;
	}
	
	.content-item{
		display: flex;
		flex-wrap: wrap;
		justify-content: space-between;
		padding: 20rpx;
	}
	.item{
		width: 210rpx;
		height: 105rpx;
		background-color: #FFFFFF;
		border-radius: 10rpx;
		margin-bottom: 20rpx;
	}
	.item-left{
		display: flex;
		flex-direction: column;
		align-items: center;
		padding-left: 20rpx;
	}
	.item-left image{
		width: 20rpx;		
		margin-top: 10rpx;
	}
	.item-right{
		width: 83rpx;
		height: 100%;
	}
	.item-right image{
		width: 100%;
	}
</style>
